﻿using Lemon.Blog.Social;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
using Volo.Abp.EntityFrameworkCore.Modeling;

namespace Lemon.Blog.EntityFrameworkCore
{
    public static class BlogDbContextModelCreatingExtensions
    {
        public static void ConfigureBlog(this ModelBuilder builder)
        {
            Check.NotNull(builder, nameof(builder));

            /* Configure your own tables/entities inside here */

            //builder.Entity<YourEntity>(b =>
            //{
            //    b.ToTable(BlogConsts.DbTablePrefix + "YourEntities", BlogConsts.DbSchema);
            //    b.ConfigureByConvention(); //auto configure for the base class props
            //    //...
            //});
            #region Blog
            builder.Entity<Blog.Blog>(b =>
            {
                b.ToTable("Blog", BlogConsts.DbSchema);
                b.ConfigureByConvention();
                //...
            });
            builder.Entity<Blog.BlogReply>(b =>
            {
                b.ToTable("BlogReply", BlogConsts.DbSchema);
                b.ConfigureByConvention();
                //...
            });
            builder.Entity<SocialMessage>(b =>
            {
                b.ToTable("SocialMessage", BlogConsts.DbSchema);
                b.ConfigureByConvention();
                //...
            });
            builder.Entity<SocialRelationship>(b =>
            {
                b.ToTable("SocialRelationship", BlogConsts.DbSchema);
                b.ConfigureByConvention();
                //...
            });
            #endregion
        }
    }
}